<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>Upload</title>

<!--装载文件-->
<link href="css/uploadify.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="scripts/jquery-1.6.min.js"></script>
<script type="text/javascript" src="scripts/swfobject.js"></script>
<script type="text/javascript" src="scripts/jquery.uploadify.v2.1.4.min.js"></script>

<!--ready事件-->
<script type="text/javascript">
	$(document).ready(function() {
		$("#uploadify").uploadify({
			'uploader' : 'scripts/uploadify.swf',
			'script' : 'servlet/Upload',//后台处理的请求  
			'cancelImg' : 'images/cancel.png',
			'folder' : 'uploads',//您想将文件保存到的路径  
			'queueID' : 'fileQueue',//与下面的id对应  
			'queueSizeLimit' : 5,
			'fileDesc' : 'rar文件或zip文件',
			'fileExt' : '*.rar;*.zip;*.txt;*.docx', //控制可上传文件的扩展名，启用本项时需同时声明fileDesc  
			'auto' : false,
			'multi' : true,
			'simUploadLimit' : 5, //The limit of uploads that can run simultaneously per Uploadify instance.
			'buttonText' : 'BROWSE',
			'displayData' : 'speed',
			'onComplete' :function(event, queueID, fileObj,response,data) {
				$("#uploadedFilesShow").append("<span>" + fileObj.name + "</span><br />");
				$("#uploadedFilesHidden").append("<span>" + response + "</span>");
			}
		});
	});
</script>
</head>

<body>
	<div id="fileQueue"></div>
	
	<input type="file" name="uploadify" id="uploadify" />
	<p>
		<a href="javascript:jQuery('#uploadify').uploadifyUpload()">开始上传</a> <a
			href="javascript:jQuery('#uploadify').uploadifyClearQueue()">取消所有上传</a>
	</p>
	
	<div id="uploadedFilesShow"></div>
	<div id="uploadedFilesHidden" ></div>
</body>
</html>
